Python

AttributeError: module 'urllib' has no attribute 'urlopen' - Python

AttributeError: module 'urllib' has no attribute 'urlopen' - Python, someone asked me to explain?

I m using the python program to bypass ssl certificate verification. I want to make an https request using the urllib library.

import ssl
import urllib

context = ssl._create_unverified_context()
res= urllib.urlopen("https://infinetsoft.com", context=context)
print(res)

I got this following error while running the python program

"AttributeError: module 'urllib' has no attribute 'urlopen'"

To resolve this problem, change the code to

import ssl
import urllib.request as urlrq

context = ssl._create_unverified_context()
res= urlrq.urlopen("https://infinetsoft.com", context=context)
print(res)

VIDEO GUIDE:

Post your comments / questions